package com.wangxinyuchuan.demo.handler;

import com.wangxinyuchuan.demo.model.User;
import org.springframework.util.StringUtils;

public class AuthHandler extends Handler{
    @Override
    public void doHandler(User user) {
        if (!StringUtils.hasText(user.getRoleName()) ||  !"管理员".equals(user.getRoleName())) {
            System.out.println("无权限访问");
            return;
        }

        if (null != next) {
            next.doHandler(user);
        }
    }
}
